<template>
  <div class="form-container">
    <!-- 标题 -->
    <div class="form-title">
      主播类型
      <span class="title-tag">游戏陪玩</span>
    </div>

    <!-- 表单主体 -->
    <div class="form-body">
      <!-- 邮箱输入 -->
      <div class="form-item">
        <label class="required">邮箱</label>
        <el-input placeholder="请输入邮箱地址，如xxx@bytedance.com" style="width: 366px" />
      </div>

      <!-- 国家地区选择 -->
      <div class="form-item">
        <label class="required">国家/地区</label>
        <el-select
          v-model="selectedCountry"
          filterable
          placeholder="请选择国家/地区"
          style="width: 366px"
        >
          <el-option
            v-for="item in countries"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </div>

      <!-- 所在区域 -->
      <div class="form-item">
        <label class="required">所在区域</label>
        <el-cascader
          v-model="selectedArea"
          :options="areaOptions"
          :props="cascaderProps"
          placeholder="请选择省市区"
          class="form-cascader"
          style="width: 366px"
        />
      </div>

      <!-- 个性签名 -->
      <div class="form-item">
        <label>个性签名</label>
        <textarea
          placeholder="请输入您的个性签名"
          class="form-textarea"
          style="width: 366px"
        ></textarea>
      </div>
    </div>

    <!-- 操作按钮 -->
    <div class="form-actions">
      <button class="save-btn">保存</button>
      <button class="reset-btn">重置</button>
    </div>
  </div>
</template>

<script lang="ts">
export default {
  name: "OtherInfo",
};
</script>
<script setup lang="ts">
import { ref, onMounted } from "vue";
import "element-plus/dist/index.css";

// 国家/地区数据
const selectedCountry = ref("");
const countries = ref([
  { value: "CN", label: "中国" },
  { value: "US", label: "美国" },
  { value: "JP", label: "日本" },
  { value: "KR", label: "韩国" },
  { value: "SG", label: "新加坡" },
]);

// 所在区域数据
const selectedArea = ref([]);
const areaOptions = ref([]);

const cascaderProps = {
  value: "code",
  label: "name",
  children: "children",
};
// 组件挂载时获取地区数据
onMounted(async () => {
  // areaOptions.value = await fetchAreaData();
});
</script>

<style lang="scss" scoped>
/* 容器样式 */
.form-container {
  width: 480px;
  // padding: 29px;
  // margin-left: 20px;
  font-size: 14px;
  color: #4e5969;
  // background-color: lightblue;
  .form-title {
    margin: 0 20px 20px 40px;
    color: #4e5969;
    display: flex;
    align-items: center;
    gap: 8px;
    // background-color: lightblue;
    .title-tag {
      font-size: 14px;
      color: #333333;
      font-weight: normal;
    }
  }

  /* 表单项样式 */
  .form-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .form-item label {
    width: 100px;
    text-align: right;
    margin-right: 16px;
    color: #4e5969;
    font-size: 14px;
  }

  .required::before {
    content: "*";
    color: #f56c6c;
    margin-right: 4px;
  }

  /* 文本域样式 */
  .form-textarea {
    height: 70px;
    padding: 5px 12px;
    font-size: 14px !important;
    color: #86909c;
  }

  /* 按钮样式 */
  .form-actions {
    margin-top: 24px;
    display: flex;
    gap: 14px;
    display: flex;
    align-items: flex-start;
    margin-left: 116px;
    justify-content: flex-start;
  }

  .save-btn {
    width: 100px;
    padding: 8px 29px;
    cursor: pointer;
    color: #ffffff;
    background: #3c80ff;
    box-shadow: 0px 2px 2px 0px rgba(22, 93, 255, 0.6);
    border-radius: 2px 2px 2px 2px;
  }
  .reset-btn {
    width: 100px;
    padding: 8px 24px;
    font-size: 14px;
    cursor: pointer;
    color: #86909c;
    background: #f2f3f5;
    border-radius: 2px 2px 2px 2px;
  }
  ::v-deep .el-select__wrapper {
    box-shadow: none !important; // 去除默认阴影
    background-color: #fff !important;
    border-radius: 0px;
  }
  ::v-deep .el-input__wrapper {
    box-shadow: none !important;
    border: none !important;
    background-color: #fff !important;
    border-radius: 0px;
  }
}
</style>
